package com.mall.service.home;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mall.client.home.MallActivityBookService;
import com.mall.custom.dao.read.MallActivityBookReadMapper;
import com.mall.custom.dao.write.MallActivityBookWriteMapper;
import com.mall.pojo.MallActivityBook;
import com.mall.pojo.MallActivityBookExample;
import com.mall.pojo.MallActivityBookExample.Criteria;

@Service
public class MallActivityBookServiceImpl implements MallActivityBookService {

	@Autowired
	private MallActivityBookReadMapper mallActivityBookReadMapper;
	@Autowired
	private MallActivityBookWriteMapper mallActivityBookWriteMapper;
	
	/**
	 * 查找活动相关人员
	 */
	@Override
	public List<MallActivityBook> getMallActivityBookListByExample(MallActivityBookExample mallActivityBookExample) {
		// TODO Auto-generated method stub
		return this.mallActivityBookReadMapper.selectByExample(mallActivityBookExample);
	}

	/**
	 * 添加活动相关人员
	 */
	@Override
	public int insertMallActivityBookByMallActivityBook(MallActivityBook mallActivityBook) {
		// TODO Auto-generated method stub
		return this.mallActivityBookWriteMapper.insert(mallActivityBook);
	}

	/**
	 * 修改参加活动相关人员信息
	 */
	@Override
	public int modifyMallActivityBookByMallActivityBookId(MallActivityBook mallActivityBook) {
		// TODO Auto-generated method stub
		return this.mallActivityBookWriteMapper.updateByPrimaryKey(mallActivityBook);
	}

	/**
	 * 根据活动id查找参加人员
	 */
	@Override
	public List<MallActivityBook> getMallActivityBookListByMallActivityId(Long MallActivityId) {
		MallActivityBookExample allActivityBookExample = new MallActivityBookExample();
		Criteria Criteria = allActivityBookExample.createCriteria();
		Criteria.andMallActivityIdEqualTo(MallActivityId);
		return this.mallActivityBookReadMapper.selectByExample(allActivityBookExample);
	}

}
